var ws_protocol = 'ws'; // ws 或 wss
var server_ip = document.getElementById("server_ip").value;
var server_port = document.getElementById("server_port").value;
var ip = server_ip;
//var ip = '192.168.1.100';
var port = server_port;

var heartbeatTimeout = 5000; // 心跳超时时间，单位：毫秒
var reconnInterval = 100; // 重连间隔时间，单位：毫秒

var binaryType = 'blob'; // 'blob' or 'arraybuffer';//arraybuffer是字节
var handler = new DemoHandler()

var tiows

function initWs () {
    layer.open({
        type: 2
        ,content: '加载中',
        shade: false
    });
        var token = androidFun.getToken();
        var queryString = 'token='+token;
        var param = null;
        tiows = new tio.ws(ws_protocol, ip, port, queryString, param, handler, heartbeatTimeout, reconnInterval, binaryType)
        tiows.connect();
        //loading带文字

    }
initWs();